from packages.common.base_model import db, {% if table.treeTable %}TreeModel{% else %}BaseModel{% endif %}


class {{table.tableHumpName}}({% if table.treeTable %}TreeModel{% else %}BaseModel{% endif %}):
    """
    {{table.comment}}模型
    """
    __tablename__ = "{{table.tableName}}"
    __table_args__ = ({"comment": "{{table.comment}}"}){% for column in table.columns %}{%if column.name not in ['id','create_time','update_time','is_deleted', 'create_user', 'update_user']%}{% if not (table.treeTable and column.name in ['parent_id', 'name', 'sort']) %}
    {{column.camelName}} = db.Column(db.{{column.type}}{%if column.hasLength%}({% if column.length is not none%}{{column.length}}{%endif%}){%endif%}, name="{{column.name}}", unique={% if column.unique is not none%}True{% else %}False{%endif%}, nullable={% if column.nullable is not none%}True{% else %}False{%endif%}{% if column.default is not none %}, default={{column.default}}{% endif %}, comment="{{column.comment}}"){% endif %}{%endif%}{% endfor %}